home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / PInterfaces / OCE.p < prev    next >
Encoding:
Text File  |  1995-04-18  |  43.6 KB  |  1,244 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        OCE.p
  3.  
  4.      Contains:    Apple Open Collaboration Environment (AOCE) Interfaces.
  5.  
  6.      Version:    Technology:    AOCE Toolbox 1.02
  7.                  Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT OCE;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __OCE__}
  30. {$SETC __OCE__ := 1}
  31.  
  32. {$I+}
  33. {$SETC OCEIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __ALIASES__}
  38. {$I Aliases.p}
  39. {$ENDC}
  40. {    Types.p                                                        }
  41. {        ConditionalMacros.p                                        }
  42. {    AppleTalk.p                                                    }
  43. {        OSUtils.p                                                }
  44. {            MixedMode.p                                            }
  45. {            Memory.p                                            }
  46. {    Files.p                                                        }
  47.  
  48. {$IFC UNDEFINED __APPLEEVENTS__}
  49. {$I AppleEvents.p}
  50. {$ENDC}
  51. {    Errors.p                                                    }
  52. {    Events.p                                                    }
  53. {        Quickdraw.p                                                }
  54. {            QuickdrawText.p                                        }
  55. {    EPPC.p                                                        }
  56. {        PPCToolbox.p                                            }
  57. {        Processes.p                                                }
  58. {    Notification.p                                                }
  59.  
  60. {$IFC UNDEFINED __SCRIPT__}
  61. {$I Script.p}
  62. {$ENDC}
  63. {    IntlResources.p                                                }
  64.  
  65. {$IFC UNDEFINED __TYPES__}
  66. {$I Types.p}
  67. {$ENDC}
  68.  
  69. {$PUSH}
  70. {$ALIGN MAC68K}
  71. {$LibExport+}
  72.  
  73. CONST
  74.     kOCECopyCreationID            = 768;
  75.     kOCECopyDirDiscriminator    = 769;
  76.     kOCECopyLocalRecordID        = 770;
  77.     kOCECopyPackedDSSpec        = 771;
  78.     kOCECopyPackedPathName        = 772;
  79.     kOCECopyPackedRLI            = 773;
  80.     kOCECopyPackedRecordID        = 774;
  81.     kOCECopyRLI                    = 775;
  82.     kOCECopyRString                = 776;
  83.     kOCECopyRecordID            = 777;
  84.     kOCECopyShortRecordID        = 778;
  85.     kOCEDuplicateRLI            = 779;
  86.     kOCEEqualCreationID            = 780;
  87.     kOCEEqualDirDiscriminator    = 781;
  88.     kOCEEqualDSSpec                = 782;
  89.     kOCEEqualLocalRecordID        = 783;
  90.     kOCEEqualPackedDSSpec        = 784;
  91.     kOCEEqualPackedPathName        = 785;
  92.     kOCEEqualPackedRecordID        = 786;
  93.     kOCEEqualPackedRLI            = 787;
  94.     kOCEEqualRecordID            = 788;
  95.     kOCEEqualRLI                = 789;
  96.     kOCEEqualRString            = 790;
  97.     kOCEEqualShortRecordID        = 791;
  98.     kOCEExtractAlias            = 792;
  99.     kOCEGetDSSpecInfo            = 793;
  100.     kOCEGetIndAttributeType        = 794;
  101.     kOCEGetIndRecordType        = 795;
  102.     kOCEGetXtnType                = 796;
  103.     kOCEIsNullPackedPathName    = 797;
  104.     kOCENewLocalRecordID        = 798;
  105.     kOCENewRLI                    = 799;
  106.     kOCENewRecordID                = 800;
  107.     kOCENewShortRecordID        = 801;
  108.     kOCEPackDSSpec                = 802;
  109.     kOCEPackPathName            = 803;
  110.     kOCEPackRLI                    = 804;
  111.     kOCEPackRLIParts            = 805;
  112.     kOCEPackRecordID            = 806;
  113.     kOCEPackedDSSpecSize        = 807;
  114.     kOCEPackedPathNameSize        = 808;
  115.     kOCEPackedRLIPartsSize        = 809;
  116.     kOCEPackedRLISize            = 810;
  117.     kOCEPackedRecordIDSize        = 811;
  118.     kOCEDNodeNameCount            = 812;
  119.     kOCERelRString                = 813;
  120.     kOCESetCreationIDtoNull        = 814;
  121.     kOCEUnpackDSSpec            = 815;
  122.     kOCEUnpackPathName            = 816;
  123.     kOCEUnpackRLI                = 817;
  124.     kOCEUnpackRecordID            = 818;
  125.     kOCEValidPackedDSSpec        = 819;
  126.     kOCEValidPackedPathName        = 820;
  127.     kOCEValidPackedRecordID        = 821;
  128.     kOCEValidPackedRLI            = 822;
  129.     kOCEValidRLI                = 823;
  130.     kOCEValidRString            = 824;
  131.     kOCECToRString                = 825;
  132.     kOCEPToRString                = 826;
  133.     kOCERToPString                = 827;
  134.     kOCEPathFinderCID            = 828;
  135.     kOCEStreamPackedDSSpec        = 829;
  136.     kOCENullCID                    = 836;
  137.     kOCEGetAccessControlDSSpec    = 837;
  138.     kOCEGetRootPackedRLI        = 838;
  139.  
  140.     
  141. TYPE
  142.     OCERecordTypeIndex = INTEGER;
  143.  
  144.     OCEAttributeTypeIndex = INTEGER;
  145.  
  146. { For anyone who absolutely needs a define of the body of the standard record or
  147. attribute type, use these below.  CAUTION!  All the types below are assumed to be
  148. in character set 'smRoman'.  If you try to compare these to some RString or
  149. AttributeType variable, you must take the character set code into account.  Future
  150. standard types may be defined using character sets other than 'smRoman'. }
  151.  
  152. CONST
  153.     kUserRecTypeNum                = 1;                            { "User" }
  154.     kGroupRecTypeNum            = 2;                            { "Group" }
  155.     kMnMRecTypeNum                = 3;                            { "AppleMail™ M&M" }
  156.     kMnMForwarderRecTypeNum        = 4;                            { "AppleMail™ Fwdr" }
  157.     kNetworkSpecRecTypeNum        = 5;                            { "NetworkSpec" }
  158.     kADAPServerRecTypeNum        = 6;                            { "ADAP Server" }
  159.     kADAPDNodeRecTypeNum        = 7;                            { "ADAP DNode" }
  160.     kADAPDNodeRepRecTypeNum        = 8;                            { "ADAP DNode Rep" }
  161.     kServerSetupRecTypeNum        = 9;                            { "Server Setup" }
  162.     kDirectoryRecTypeNum        = 10;                            { "Directory" }
  163.     kDNodeRecTypeNum            = 11;                            { "DNode" }
  164.     kSetupRecTypeNum            = 12;                            { "Setup" }
  165.     kMSAMRecTypeNum                = 13;                            { "MSAM" }
  166.     kDSAMRecTypeNum                = 14;                            { "DSAM" }
  167.     kAttributeValueRecTypeNum    = 15;                            { "Attribute Value" }
  168.     kBusinessCardRecTypeNum        = 16;                            { "Business Card" }
  169.     kMailServiceRecTypeNum        = 17;                            { "Mail Service" }
  170.     kCombinedRecTypeNum            = 18;                            { "Combined" }
  171.     kOtherServiceRecTypeNum        = 19;                            { "Other Service" }
  172.     kAFPServiceRecTypeNum        = 20;                            { "Other Service afps" }
  173.     kFirstOCERecTypeNum            = kUserRecTypeNum;                { first standard OCE record type }
  174.     kLastOCERecTypeNum            = kAFPServiceRecTypeNum;        { last standard OCE record type }
  175.     kNumOCERecTypes                = 0+(kLastOCERecTypeNum - kFirstOCERecTypeNum + 1);
  176.  
  177. { Indices for the standard definitions for certain attribute types (OCEAttributeTypeIndex): }
  178.     kMemberAttrTypeNum            = 1001;                            { "Member" }
  179.     kAdminsAttrTypeNum            = 1002;                            { "Administrators" }
  180.     kMailSlotsAttrTypeNum        = 1003;                            { "mailslots" }
  181.     kPrefMailAttrTypeNum        = 1004;                            { "pref mailslot" }
  182.     kAddressAttrTypeNum            = 1005;                            { "Address" }
  183.     kPictureAttrTypeNum            = 1006;                            { "Picture" }
  184.     kAuthKeyAttrTypeNum            = 1007;                            { "auth key" }
  185.     kTelephoneAttrTypeNum        = 1008;                            { "Telephone" }
  186.     kNBPNameAttrTypeNum            = 1009;                            { "NBP Name" }
  187.     kQMappingAttrTypeNum        = 1010;                            { "ForwarderQMap" }
  188.     kDialupSlotAttrTypeNum        = 1011;                            { "DialupSlotInfo" }
  189.     kHomeNetAttrTypeNum            = 1012;                            { "Home Internet" }
  190.     kCoResAttrTypeNum            = 1013;                            { "Co-resident M&M" }
  191.     kFwdrLocalAttrTypeNum        = 1014;                            { "FwdrLocalRecord" }
  192.     kConnectAttrTypeNum            = 1015;                            { "Connected To" }
  193.     kForeignAttrTypeNum            = 1016;                            { "Foreign RLIs" }
  194.     kOwnersAttrTypeNum            = 1017;                            { "Owners" }
  195.     kReadListAttrTypeNum        = 1018;                            { "ReadList" }
  196.     kWriteListAttrTypeNum        = 1019;                            { "WriteList" }
  197.     kDescriptorAttrTypeNum        = 1020;                            { "Descriptor" }
  198.     kCertificateAttrTypeNum        = 1021;                            { "Certificate" }
  199.     kMsgQsAttrTypeNum            = 1022;                            { "MessageQs" }
  200.     kPrefMsgQAttrTypeNum        = 1023;                            { "PrefMessageQ" }
  201.     kMasterPFAttrTypeNum        = 1024;                            { "MasterPF" }
  202.     kMasterNetSpecAttrTypeNum    = 1025;                            { "MasterNetSpec" }
  203.     kServersOfAttrTypeNum        = 1026;                            { "Servers Of" }
  204.     kParentCIDAttrTypeNum        = 1027;                            { "Parent CID" }
  205.     kNetworkSpecAttrTypeNum        = 1028;                            { "NetworkSpec" }
  206.     kLocationAttrTypeNum        = 1029;                            { "Location" }
  207.     kTimeSvrTypeAttrTypeNum        = 1030;                            { "TimeServer Type" }
  208.     kUpdateTimerAttrTypeNum        = 1031;                            { "Update Timer" }
  209.     kShadowsOfAttrTypeNum        = 1032;                            { "Shadows Of" }
  210.     kShadowServerAttrTypeNum    = 1033;                            { "Shadow Server" }
  211.     kTBSetupAttrTypeNum            = 1034;                            { "TB Setup" }
  212.     kMailSetupAttrTypeNum        = 1035;                            { "Mail Setup" }
  213.     kSlotIDAttrTypeNum            = 1036;                            { "SlotID" }
  214.     kGatewayFileIDAttrTypeNum    = 1037;                            { "Gateway FileID" }
  215.     kMailServiceAttrTypeNum        = 1038;                            { "Mail Service" }
  216.     kStdSlotInfoAttrTypeNum        = 1039;                            { "Std Slot Info" }
  217.     kAssoDirectoryAttrTypeNum    = 1040;                            { "Asso. Directory" }
  218.     kDirectoryAttrTypeNum        = 1041;                            { "Directory" }
  219.     kDirectoriesAttrTypeNum        = 1042;                            { "Directories" }
  220.     kSFlagsAttrTypeNum            = 1043;                            { "SFlags" }
  221.     kLocalNameAttrTypeNum        = 1044;                            { "Local Name" }
  222.     kLocalKeyAttrTypeNum        = 1045;                            { "Local Key" }
  223.     kDirUserRIDAttrTypeNum        = 1046;                            { "Dir User RID" }
  224.     kDirUserKeyAttrTypeNum        = 1047;                            { "Dir User Key" }
  225.     kDirNativeNameAttrTypeNum    = 1048;                            { "Dir Native Name" }
  226.     kCommentAttrTypeNum            = 1049;                            { "Comment" }
  227.     kRealNameAttrTypeNum        = 1050;                            { "Real Name" }
  228.     kPrivateDataAttrTypeNum        = 1051;                            { "Private Data" }
  229.     kDirTypeAttrTypeNum            = 1052;                            { "Directory Type" }
  230.     kDSAMFileAliasAttrTypeNum    = 1053;                            { "DSAM File Alias" }
  231.     kCanAddressToAttrTypeNum    = 1054;                            { "Can Address To" }
  232.     kDiscriminatorAttrTypeNum    = 1055;                            { "Discriminator" }
  233.     kAliasAttrTypeNum            = 1056;                            { "Alias" }
  234.     kParentMSAMAttrTypeNum        = 1057;                            { "Parent MSAM" }
  235.     kParentDSAMAttrTypeNum        = 1058;                            { "Parent DSAM" }
  236.     kSlotAttrTypeNum            = 1059;                            { "Slot" }
  237.     kAssoMailServiceAttrTypeNum    = 1060;                            { "Asso. Mail Service" }
  238.     kFakeAttrTypeNum            = 1061;                            { "Fake" }
  239.     kInheritSysAdminAttrTypeNum    = 1062;                            { "Inherit SysAdministrators" }
  240.     kPreferredPDAttrTypeNum        = 1063;                            { "Preferred PD" }
  241.     kLastLoginAttrTypeNum        = 1064;                            { "Last Login" }
  242.     kMailerAOMStateAttrTypeNum    = 1065;                            { "Mailer AOM State" }
  243.     kMailerSendOptionsAttrTypeNum = 1066;                        { "Mailer Send Options" }
  244.     kJoinedAttrTypeNum            = 1067;                            { "Joined" }
  245.     kUnconfiguredAttrTypeNum    = 1068;                            { "Unconfigured" }
  246.     kVersionAttrTypeNum            = 1069;                            { "Version" }
  247.     kLocationNamesAttrTypeNum    = 1070;                            { "Location Names" }
  248.     kActiveAttrTypeNum            = 1071;                            { "Active" }
  249.     kDeleteRequestedAttrTypeNum    = 1072;                            { "Delete Requested" }
  250.     kGatewayTypeAttrTypeNum        = 1073;                            { "Gateway Type" }
  251.     kFirstOCEAttrTypeNum        = kMemberAttrTypeNum;            { first standard OCE attr type }
  252.     kLastOCEAttrTypeNum            = kGatewayTypeAttrTypeNum;        { last standard OCE attr type }
  253.     kNumOCEAttrTypes            = 0+(kLastOCEAttrTypeNum - kFirstOCEAttrTypeNum + 1);
  254.  
  255. { Miscellaneous enums: }
  256.     kRString32Size                = 32;                            { max size of the body field in RString32 }
  257.     kRString64Size                = 64;                            { max size of the body field in RString64 }
  258.     kNetworkSpecMaxBytes        = 32;                            { max size of the body field in NetworkSpec }
  259.     kPathNameMaxBytes            = 1024;                            { max size of the data field in PackedPathName }
  260.     kDirectoryNameMaxBytes        = 32;                            { max size of the body field in DirectoryName }
  261.     kAttributeTypeMaxBytes        = 32;                            { max size of the body field in AttributeType }
  262.     kAttrValueMaxBytes            = 65536;                        { max size of any attribute value }
  263.     kRStringMaxBytes            = 256;                            { max size (in bytes) of the body field of a recordName or recordType }
  264.     kRStringMaxChars            = 128;                            { max size (in chars) of the body field of a recordName or recordType }
  265.  
  266.     kNULLDNodeNumber            = 0;                            { Special value meaning none specified }
  267.     kRootDNodeNumber            = 2;                            { DNodeNum corresponding to the root of the tree }
  268.  
  269. { This enum is used to select the kind of RString in calls such as OCERelRString,
  270. OCEEqualRString, and OCEValidRString.
  271.  
  272. eGenericSensitive and eGenericInsensitive are enumerators that can be used if you
  273. use RStrings for things other than what you see in this file.  If you want them to
  274. be compared in a case- and diacritical-sensitive manner (c ≠ C ≠ ç), use
  275. eGenericSensitive.  If you want them to be compared in a case- and diacritical-
  276. insensitive manner (c = C = ç), use eGenericInensitive.
  277. WARNING:  do not use eGenericSensitive and eGenericInsensitive with catalog
  278. names, entity names, pathname parts, entity types, network specs, or attribute
  279. types!  Don't assume that you know how they should be compared!!! }
  280.     kOCEDirName                    = 0;
  281.     kOCERecordOrDNodeName        = 1;
  282.     kOCERecordType                = 2;
  283.     kOCENetworkSpec                = 3;
  284.     kOCEAttrType                = 4;
  285.     kOCEGenericSensitive        = 5;
  286.     kOCEGenericInsensitive        = 6;
  287.  
  288.     
  289. TYPE
  290.     RStringKind = INTEGER;
  291.  
  292. { Values for the signature field in Discriminator }
  293.  
  294. CONST
  295.     kDirAllKinds                = 0;
  296.     kDirADAPKind                = 'adap';
  297.     kDirPersonalDirectoryKind    = 'pdir';
  298.     kDirDSAMKind                = 'dsam';
  299.  
  300.     
  301. TYPE
  302.     OCEDirectoryKind = LONGINT;
  303.  
  304. { Values returned by GetDSSpecInfo() }
  305.  
  306. CONST
  307.     kOCEInvalidDSSpec            = $3F3F3F3F;                    { could not be determined }
  308.     kOCEDirsRootDSSpec            = 'root';                        { root of all catalogs ("Catalogs" icon) }
  309.     kOCEDirectoryDSSpec            = 'dire';                        { catalog }
  310.     kOCEDNodeDSSpec                = 'dnod';                        { d-node }
  311.     kOCERecordDSSpec            = 'reco';                        { record }
  312.     kOCEentnDSSpec                = 'entn';                        { extensionType is 'entn' }
  313.     kOCENOTentnDSSpec            = 'not ';
  314.  
  315. { Values for AttributeTag }
  316.     typeRString                    = 'rstr';
  317.     typePackedDSSpec            = 'dspc';
  318.     typeBinary                    = 'bnry';
  319.  
  320. { Bit flag corresponding to the canContainRecords bit.  Use it like this:
  321.     if (foo & kCanContainRecords)
  322.         then this dNode can contain records!
  323. kForeignNode is used to indicate nodes in the name hierarchy that correspond to
  324. foreign catalogs (meaning ADAP sees no clusters or DNodes beneath it, but
  325. mail routers might be able to route to clusters beneath it. }
  326.     kCanContainRecordsBit        = 0;
  327.     kForeignNodeBit                = 1;
  328.  
  329. { DirNodeKind }
  330.     kCanContainRecords            = 1 * (2**(kCanContainRecordsBit));
  331.     kForeignNode                = 1 * (2**(kForeignNodeBit));
  332.  
  333.     
  334. TYPE
  335.     DirNodeKind = LONGINT;
  336.  
  337. {*** Toolbox Control ***}
  338. { We will have a version number and attributes for toolboxes off the aa5e trap
  339. and the S&F server trap.
  340.  
  341. This includes the OCE toolbox and S&F Server.  [Note: the S&F server will
  342. change to ONLY service ServerGateway calls —it will then be necessary to run
  343. it co–resident with an OCE toolbox].
  344.  
  345. The high order word will represent the S&F Server version number.  The low
  346. order word will represent the OCE toolbox version number.  These will be zero
  347. until the component is up and running.  It is not possible to know these
  348. a–priori. Note: there will not be a seperate version numbers for each component
  349. in the OCE toolbox or S&F server.
  350.  
  351. The above is consistent with the standard System 7.0 usage of Gestalt.
  352.  
  353. The oce tb attribute gestaltOCETBPresent implies the existence of OCE on a
  354. machine.
  355.  
  356. The OCE TB attribute gestaltOCETBAvailable implies the availablity of OCE calls.
  357.  
  358. The attribute gestaltOCESFServerAvailable implies the availablity of OCE calls
  359. available through the S&F server. This are essentially the server gateway calls.
  360.  
  361. Any (future) remaining OCE attributes may not be established correctly until
  362. the attribute gestaltOCETBAvailable is set.
  363.  
  364. The gestalt selectors and values are listed below: }
  365.  
  366. CONST
  367.     gestaltOCEToolboxVersion    = 'ocet';                        { OCE Toolbox version }
  368.     gestaltOCEToolboxAttr        = 'oceu';
  369.  
  370. { version includes:
  371.  *  dirtb
  372.  *  authtb
  373.  *  mailtb
  374.  *  ipmtb
  375.  *  personal catalog
  376.  *  ADSPSecure
  377.  * e.g. all interfaces dependent on the aa5e trap. }
  378.     gestaltOCETB                = $0102;                        { OCE Toolbox version 1.02 }
  379.     gestaltSFServer                = $0100;                        { S&F Server version 1.0 }
  380.     gestaltOCETBPresent            = $01;                            { OCE toolbox is present, not running }
  381.     gestaltOCETBAvailable        = $02;                            { OCE toolbox is running and available }
  382.     gestaltOCESFServerAvailable    = $04;                            { S&F Server is running and available }
  383.     gestaltOCETBNativeGlueAvailable = $10;                        { Native PowerPC Glue routines are availible }
  384.  
  385. {    Constants used for Transitions. }
  386.     ATTransIPMStart                = 'ipms';
  387.     ATTransIPMShutdown            = 'ipmd';
  388.     ATTransDirStart                = 'dirs';
  389.     ATTransDirShutdown            = 'dird';
  390.     ATTransAuthStart            = 'auts';
  391.     ATTransAuthShutdown            = 'autd';
  392.     ATTransSFStart                = 's&fs';
  393.     ATTransSFShutdown            = 's&fd';
  394.  
  395. { Some definitions for time-related parameters: }
  396. { Interpreted as UTC seconds since 1/1/1904 }
  397.     
  398. TYPE
  399.     UTCTime = LONGINT;
  400.  
  401. { seconds EAST of Greenwich }
  402.     UTCOffset = LONGINT;
  403.  
  404. { This is the same as the ScriptManager script. }
  405.     CharacterSet = INTEGER;
  406.  
  407. {*** RString ***}
  408. { struct RString is a maximum-sized structure.  Allocate one of these and it will
  409. hold any valid RString. }
  410.     RString = RECORD
  411.         charSet:                CharacterSet;
  412.         dataLength:                INTEGER;
  413.         body:                    ARRAY [0..kRStringMaxBytes-1] OF SInt8; (* Byte *) { place for characters }
  414.     END;
  415.  
  416. { struct ProtoRString is a minimum-sized structure.  Use this for a variable-length RString. }
  417.     ProtoRString = RECORD
  418.         charSet:                CharacterSet;
  419.         dataLength:                INTEGER;
  420.     END;
  421.  
  422.     RStringPtr = ^RString;
  423.     RStringHandle = ^RStringPtr;
  424.  
  425.     ProtoRStringPtr = ^ProtoRString;
  426.  
  427.     RString64 = RECORD
  428.         charSet:                CharacterSet;
  429.         dataLength:                INTEGER;
  430.         body:                    ARRAY [0..kRString64Size-1] OF SInt8; (* Byte *)
  431.     END;
  432.  
  433.     RString32 = RECORD
  434.         charSet:                CharacterSet;
  435.         dataLength:                INTEGER;
  436.         body:                    ARRAY [0..kRString32Size-1] OF SInt8; (* Byte *)
  437.     END;
  438.  
  439. { Standard definitions for the entity type field and attribute type
  440. have been moved to the end of the file. }
  441. { Copies str1 to str2.  str2Length is the size of str2, excluding header.
  442. A memFull error will be returned if that is not as large as str1->dataLength. }
  443.  
  444. FUNCTION OCECopyRString({CONST}VAR str1: RString; VAR str2: RString; str2Length: INTEGER): OSErr;
  445.     {$IFC NOT GENERATINGCFM}
  446.     INLINE $303C, 776, $AA5C;
  447.     {$ENDC}
  448. {    Make an RString from a C string.  If the c string is bigger than rStrLength,
  449. only rStrLength bytes will be copied. (rStrLength does not include the header size) }
  450. PROCEDURE OCECToRString(cStr: ConstCStringPtr; charSet: CharacterSet; VAR rStr: RString; rStrLength: INTEGER);
  451.     {$IFC NOT GENERATINGCFM}
  452.     INLINE $303C, 825, $AA5C;
  453.     {$ENDC}
  454. {    Make an RString from a Pascal string.  If the Pascal string is bigger than rStrLength,
  455. only rStrLength bytes will be copied. (rStrLength does not include the header size) }
  456. PROCEDURE OCEPToRString(pStr: ConstStr255Param; charSet: CharacterSet; VAR rStr: RString; rStrLength: INTEGER);
  457.     {$IFC NOT GENERATINGCFM}
  458.     INLINE $303C, 826, $AA5C;
  459.     {$ENDC}
  460. {    Make a Pascal string from an RString.  It's up to you to check the char set of
  461. the RString, or if the length of the RString is greater than 255 (the Pascal string's
  462. length will simply be the lower byte of the RString's length).  The StringPtr that is
  463. returned will point directly into the RString (no memory will be allocated). }
  464. FUNCTION OCERToPString({CONST}VAR rStr: RString): StringPtr;
  465.     {$IFC NOT GENERATINGCFM}
  466.     INLINE $303C, 827, $AA5C;
  467.     {$ENDC}
  468. {    Check the relative equality of two RStrings.  Determines if str1 is greater than,
  469. equal to, or less than str2.  Result types for OCERelRString are defined in <OSUtils.h>
  470. (same as for RelString). }
  471. FUNCTION OCERelRString(str1: UNIV Ptr; str2: UNIV Ptr; kind: RStringKind): INTEGER;
  472.     {$IFC NOT GENERATINGCFM}
  473.     INLINE $303C, 813, $AA5C;
  474.     {$ENDC}
  475. {    Check for equality of two RStrings. Returns true if equal. }
  476. FUNCTION OCEEqualRString(str1: UNIV Ptr; str2: UNIV Ptr; kind: RStringKind): BOOLEAN;
  477.     {$IFC NOT GENERATINGCFM}
  478.     INLINE $303C, 790, $AA5C;
  479.     {$ENDC}
  480. {    Check the validity of an RString.  Returns true if the RString is valid }
  481. FUNCTION OCEValidRString(str: UNIV Ptr; kind: RStringKind): BOOLEAN;
  482.     {$IFC NOT GENERATINGCFM}
  483.     INLINE $303C, 824, $AA5C;
  484.     {$ENDC}
  485. {*** CreationID ***}
  486.  
  487. TYPE
  488.     CreationID = RECORD
  489.         source:                    LONGINT;                                { Fields definitions and usage are not defined }
  490.         seq:                    LONGINT;
  491.     END;
  492.  
  493.     AttributeCreationID = CreationID;
  494.  
  495. { Returns a pointer to a null CreationID . }
  496.  
  497. FUNCTION OCENullCID: CreationID;
  498.     {$IFC NOT GENERATINGCFM}
  499.     INLINE $303C, 836, $AA5C;
  500.     {$ENDC}
  501. { Returns a pointer to a special CreationID used within the PathFinder. }
  502. FUNCTION OCEPathFinderCID: CreationID;
  503.     {$IFC NOT GENERATINGCFM}
  504.     INLINE $303C, 828, $AA5C;
  505.     {$ENDC}
  506. { Sets the CreationID to a null value. }
  507. PROCEDURE OCESetCreationIDtoNull(VAR cid: CreationID);
  508.     {$IFC NOT GENERATINGCFM}
  509.     INLINE $303C, 814, $AA5C;
  510.     {$ENDC}
  511. { Copies the value of cid1 to cid2. }
  512. PROCEDURE OCECopyCreationID({CONST}VAR cid1: CreationID; VAR cid2: CreationID);
  513.     {$IFC NOT GENERATINGCFM}
  514.     INLINE $303C, 768, $AA5C;
  515.     {$ENDC}
  516. { Check the equality of two CreationIDs. }
  517. FUNCTION OCEEqualCreationID({CONST}VAR cid1: CreationID; {CONST}VAR cid2: CreationID): BOOLEAN;
  518.     {$IFC NOT GENERATINGCFM}
  519.     INLINE $303C, 780, $AA5C;
  520.     {$ENDC}
  521. {*** NetworkSpec ***}
  522. { For the record, a NetworkSpec is an RString with a smaller maximum size.
  523. I don't just typedef it to an RString, because I want the definition of the NetworkSpec
  524. struct to contain the max length.  But it should be possible to typecast any
  525. NetworkSpec to an RString and use all the RString utilities on it. }
  526.  
  527. TYPE
  528.     NetworkSpec = RECORD
  529.         charSet:                CharacterSet;
  530.         dataLength:                INTEGER;
  531.         body:                    ARRAY [0..kNetworkSpecMaxBytes-1] OF SInt8; (* Byte *) { always fixed at the max size }
  532.     END;
  533.  
  534.     NetworkSpecPtr = ^NetworkSpec;
  535.  
  536. {*** PackedPathName ***}
  537. { struct PackedPathName is a maximum-sized structure.  Allocate one of
  538. these and it will hold any valid packed pathname. }
  539.     PackedPathName = RECORD
  540.         dataLength:                INTEGER;
  541.         data:                    ARRAY [0..kPathNameMaxBytes - 2-1] OF SInt8; (* Byte *)
  542.     END;
  543.  
  544. { struct ProtoPackedPathName is a minimum-sized structure.  Use this
  545. for a variable-length packed PathName. }
  546.     ProtoPackedPathName = RECORD
  547.         dataLength:                INTEGER;
  548.     END;
  549.  
  550.     PackedPathNamePtr = ^PackedPathName;
  551.  
  552.     ProtoPackedPathNamePtr = ^ProtoPackedPathName;
  553.  
  554. {
  555. Copy the contents of path1 to path2.  path2Length is the size of path2, and must
  556. be large enough to hold a copy of path1.  A memFull error will be returned if that
  557. is not the case.
  558. }
  559.  
  560. FUNCTION OCECopyPackedPathName({CONST}VAR path1: PackedPathName; VAR path2: PackedPathName; path2Length: INTEGER): OSErr;
  561.     {$IFC NOT GENERATINGCFM}
  562.     INLINE $303C, 772, $AA5C;
  563.     {$ENDC}
  564. {
  565. Returns true if packed path pointer is nil, or is of zero length, or is of
  566. length 2 and nParts of zero.
  567. }
  568. FUNCTION OCEIsNullPackedPathName({CONST}VAR path: PackedPathName): BOOLEAN;
  569.     {$IFC NOT GENERATINGCFM}
  570.     INLINE $303C, 797, $AA5C;
  571.     {$ENDC}
  572. {
  573. OCEUnpackPathName breaks apart the path into its component RStrings, writing string
  574. pointers into the array 'parts', which the client asserts can hold as many as
  575. 'nParts' elements. The number of parts actually found is returned.  Strings are
  576. placed in the array in order from lowest to highest.  The first pathName element
  577. beneath the root appears last.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO
  578. THE PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED
  579. WITH THE UNPACKED STRUCT AS WELL
  580. }
  581. FUNCTION OCEUnpackPathName({CONST}VAR path: PackedPathName; VAR parts: RStringPtr; nParts: INTEGER): INTEGER;
  582.     {$IFC NOT GENERATINGCFM}
  583.     INLINE $303C, 816, $AA5C;
  584.     {$ENDC}
  585. FUNCTION OCEPackedPathNameSize({CONST}VAR parts: RStringPtr; nParts: INTEGER): INTEGER;
  586.     {$IFC NOT GENERATINGCFM}
  587.     INLINE $303C, 808, $AA5C;
  588.     {$ENDC}
  589. FUNCTION OCEDNodeNameCount({CONST}VAR path: PackedPathName): INTEGER;
  590.     {$IFC NOT GENERATINGCFM}
  591.     INLINE $303C, 812, $AA5C;
  592.     {$ENDC}
  593. {
  594. OCEPackPathName packs the parts into the storage provided as 'path'.  path must be
  595. large enough to hold the packed pathname.  A memFull error will be returned if
  596. pathLength is too small.  parts[0] should contain the deepest pathName element,
  597. and parts[nParts - 1] should contain the name of the first pathName element beneath
  598. the root. 
  599. }
  600. FUNCTION OCEPackPathName(VAR parts: RStringPtr; nParts: INTEGER; VAR path: PackedPathName; pathLength: INTEGER): OSErr;
  601.     {$IFC NOT GENERATINGCFM}
  602.     INLINE $303C, 803, $AA5C;
  603.     {$ENDC}
  604. FUNCTION OCEEqualPackedPathName({CONST}VAR path1: PackedPathName; {CONST}VAR path2: PackedPathName): BOOLEAN;
  605.     {$IFC NOT GENERATINGCFM}
  606.     INLINE $303C, 785, $AA5C;
  607.     {$ENDC}
  608. {
  609. OCEValidPackedPathName checks that the packed PathName is internally consistent.
  610. Returns true if it's ok.
  611. }
  612. FUNCTION OCEValidPackedPathName({CONST}VAR path: PackedPathName): BOOLEAN;
  613.     {$IFC NOT GENERATINGCFM}
  614.     INLINE $303C, 820, $AA5C;
  615.     {$ENDC}
  616. {*** DirDiscriminator ***}
  617.  
  618. TYPE
  619.     DirDiscriminator = RECORD
  620.         signature:                OCEDirectoryKind;
  621.         misc:                    LONGINT;
  622.     END;
  623.  
  624. { Copies the value of disc1 to disc2. }
  625.  
  626. PROCEDURE OCECopyDirDiscriminator({CONST}VAR disc1: DirDiscriminator; VAR disc2: DirDiscriminator);
  627.     {$IFC NOT GENERATINGCFM}
  628.     INLINE $303C, 769, $AA5C;
  629.     {$ENDC}
  630. { Check the equality of two DirDiscriminators. }
  631. FUNCTION OCEEqualDirDiscriminator({CONST}VAR disc1: DirDiscriminator; {CONST}VAR disc2: DirDiscriminator): BOOLEAN;
  632.     {$IFC NOT GENERATINGCFM}
  633.     INLINE $303C, 781, $AA5C;
  634.     {$ENDC}
  635. {
  636. This structure is called RLI because it really contains all the info you
  637. need to locate a record within the entire name space.  It contains four fields.
  638. The first two are the name of the catalog and a catalog discriminator.  These
  639. two fields are used to indicate to which catalog a given record belongs.  The
  640. discriminator is used to distinguish between two different catalogs that have
  641. the same name.
  642.  
  643. The other two fields in the RLI structure are used to indicate a particular
  644. catalog node within the catalog specified by the directoryName and
  645. discriminator fields.  These fields are exactly analagous to the dirID and
  646. pathname used in HFS.  It is possible to specify a dNode just by dNodeNumber
  647. (pathname is nil), or just by pathname (dNodeNumber is set to kNULLDNodeNumber),
  648. or by a combination of the two.  The latter is called a 'partial pathname', and
  649. while it is valid in the Catalog Manager API, it is not supported by ADAP
  650. catalogs in Release 1.
  651.  
  652. Note that the path parameter does not include the catalog name, but holds
  653. the names of all the nodes on the path to the desired catalog node, starting
  654. with the catalog node and working its way up the tree.
  655. }
  656. {*** RLI ***}
  657.  
  658. TYPE
  659.     DirectoryName = RECORD
  660.         charSet:                CharacterSet;
  661.         dataLength:                INTEGER;
  662.         body:                    ARRAY [0..kDirectoryNameMaxBytes-1] OF SInt8; (* Byte *) { space for catalog name }
  663.     END;
  664.  
  665.     DirectoryNamePtr = ^DirectoryName;
  666.  
  667. { Catalog node number }
  668.     DNodeNum = LONGINT;
  669.  
  670.     RLI = RECORD
  671.         directoryName:            DirectoryNamePtr;                        { pointer to the name of the catalog root }
  672.         discriminator:            DirDiscriminator;                        { used to discriminate between dup catalog names }
  673.         dNodeNumber:            DNodeNum;                                { number of the node }
  674.         path:                    PackedPathNamePtr;                        { old-style RLI }
  675.     END;
  676.  
  677.     RLIPtr = ^RLI;
  678.  
  679. {
  680. Create a new RLI from the catalog name, discriminator, DNode number, and
  681. PackedPathName.  You must allocate the storage for the RLI and pass in a pointer
  682. to it.
  683. }
  684.  
  685. PROCEDURE OCENewRLI(VAR newRLI: RLI; {CONST}VAR dirName: DirectoryName; VAR discriminator: DirDiscriminator; dNodeNumber: DNodeNum; {CONST}VAR path: PackedPathName);
  686.     {$IFC NOT GENERATINGCFM}
  687.     INLINE $303C, 799, $AA5C;
  688.     {$ENDC}
  689. {
  690. Duplicate the contents of rli1 to rli2.  No errors are returned. This
  691. simply copies the pointers to the catalog name and path, wiping out any pointer
  692. that you might have had in there.
  693. }
  694. PROCEDURE OCEDuplicateRLI({CONST}VAR rli1: RLI; VAR rli2: RLI);
  695.     {$IFC NOT GENERATINGCFM}
  696.     INLINE $303C, 779, $AA5C;
  697.     {$ENDC}
  698. {
  699. Copy the contents of rli1 to rli2.  rli2 must already contain
  700. pointers to structures large enough to hold copies of the corresponding
  701. fields from rli1.  A memFull error will be returned if that is not the case.
  702. So if you allocate a brand new empty destination, you must at least set up
  703. its length fields.
  704. }
  705. FUNCTION OCECopyRLI({CONST}VAR rli1: RLI; VAR rli2: RLI): OSErr;
  706.     {$IFC NOT GENERATINGCFM}
  707.     INLINE $303C, 775, $AA5C;
  708.     {$ENDC}
  709. {
  710. Check the equality of two RLIs.  This will take into account differences
  711. in the case and diacriticals of the directoryName and the PathName.
  712. NOTE THAT THIS WILL FAIL IF rli1 CONTAINS A DNODENUMBER AND A NIL PATHNAME,
  713. AND rli2 CONTAINS kNULLDNodeNumber AND A NON-NIL PATHNAME.  IN OTHER WORDS,
  714. THE TWO rlis MUST BE OF THE SAME FORM TO CHECK FOR EQUALITY.
  715. The one exception is that if the pathname is nil, a dNodeNumber of zero and
  716. kRootDNodeNumber will be treated as equal.
  717. }
  718. FUNCTION OCEEqualRLI({CONST}VAR rli1: RLI; {CONST}VAR rli2: RLI): BOOLEAN;
  719.     {$IFC NOT GENERATINGCFM}
  720.     INLINE $303C, 789, $AA5C;
  721.     {$ENDC}
  722. {
  723. Check the validity of an RLI.  This checks that the catalog name length
  724. is within bounds, and the packed pathname (if specified) is valid.
  725. }
  726. FUNCTION OCEValidRLI({CONST}VAR theRLI: RLI): BOOLEAN;
  727.     {$IFC NOT GENERATINGCFM}
  728.     INLINE $303C, 823, $AA5C;
  729.     {$ENDC}
  730. {*** PackedRLI ***}
  731. {
  732. struct PackedRLI is a maximum-sized structure.  Allocate one of
  733. these and it will hold any valid packed pathname.
  734. }
  735.  
  736. CONST
  737.     kRLIMaxBytes                = 0+(sizeof(RString) + sizeof(DirDiscriminator) + sizeof(DNodeNum) + kPathNameMaxBytes);
  738.  
  739.  
  740. TYPE
  741.     PackedRLI = RECORD
  742.         dataLength:                INTEGER;
  743.         data:                    ARRAY [0..kRLIMaxBytes-1] OF SInt8; (* Byte *)
  744.     END;
  745.  
  746. {
  747. struct ProtoPackedRLI is a minimum-sized structure.  Use this
  748. for a variable-length packed RLI.
  749. }
  750.     ProtoPackedRLI = RECORD
  751.         dataLength:                INTEGER;
  752.     END;
  753.  
  754.     PackedRLIPtr = ^PackedRLI;
  755.  
  756.     ProtoPackedRLIPtr = ^ProtoPackedRLI;
  757.  
  758. {
  759. Copy the contents of prli1 to prli2.  prli2Length is the size of prli2, and must
  760. be large enough to hold a copy of prli1.  A memFull error will be returned if that
  761. is not the case.
  762. }
  763.  
  764. FUNCTION OCECopyPackedRLI({CONST}VAR prli1: PackedRLI; VAR prli2: PackedRLI; prli2Length: INTEGER): OSErr;
  765.     {$IFC NOT GENERATINGCFM}
  766.     INLINE $303C, 773, $AA5C;
  767.     {$ENDC}
  768. {
  769. OCEUnpackRLI breaks apart the prli into its components, writing pointers into
  770. the rli structure.  NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE
  771. PACKED STRUCT - DON'T DELETE OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED
  772. WITH THE UNPACKED STRUCT AS WELL
  773. }
  774. PROCEDURE OCEUnpackRLI({CONST}VAR prli: PackedRLI; VAR theRLI: RLI);
  775.     {$IFC NOT GENERATINGCFM}
  776.     INLINE $303C, 817, $AA5C;
  777.     {$ENDC}
  778. {
  779. OCEPackedRLISize computes the number of bytes of memory needed to hold a
  780. PackedRLI manufactured from an RLI.  This length
  781. includes the length of the length field of PackedRLI, so it
  782. is safe to do a NewPtr (OCEPackedRLISize(...)).
  783. }
  784. FUNCTION OCEPackedRLISize({CONST}VAR theRLI: RLI): INTEGER;
  785.     {$IFC NOT GENERATINGCFM}
  786.     INLINE $303C, 810, $AA5C;
  787.     {$ENDC}
  788. {
  789. OCEPackRLI packs the RLI into the storage provided as 'prli'.  prli must be
  790. large enough to hold the packed RLI.  A memFull error will be returned if
  791. prliLength is too small.
  792. }
  793. FUNCTION OCEPackRLI({CONST}VAR theRLI: RLI; VAR prli: PackedRLI; prliLength: INTEGER): OSErr;
  794.     {$IFC NOT GENERATINGCFM}
  795.     INLINE $303C, 804, $AA5C;
  796.     {$ENDC}
  797. {
  798. OCEPackedRLIPartsSize computes the number of bytes of memory needed to hold a
  799. PackedRLI manufactured from the parts of an RLI.  This length
  800. includes the length of the length field of PackedRLI, so it
  801. is safe to do a NewPtr (OCEPackedRLIPartsSize(...)).
  802. }
  803. FUNCTION OCEPackedRLIPartsSize({CONST}VAR dirName: DirectoryName; VAR parts: RStringPtr; nParts: INTEGER): INTEGER;
  804.     {$IFC NOT GENERATINGCFM}
  805.     INLINE $303C, 809, $AA5C;
  806.     {$ENDC}
  807. FUNCTION OCEPackRLIParts({CONST}VAR dirName: DirectoryName; {CONST}VAR discriminator: DirDiscriminator; dNodeNumber: DNodeNum; VAR parts: RStringPtr; nParts: INTEGER; VAR prli: PackedRLI; prliLength: INTEGER): OSErr;
  808.     {$IFC NOT GENERATINGCFM}
  809.     INLINE $303C, 805, $AA5C;
  810.     {$ENDC}
  811. FUNCTION OCEEqualPackedRLI({CONST}VAR prli1: PackedRLI; {CONST}VAR prli2: PackedRLI): BOOLEAN;
  812.     {$IFC NOT GENERATINGCFM}
  813.     INLINE $303C, 787, $AA5C;
  814.     {$ENDC}
  815. {
  816. Check the validity of a packed RLI.  This checks that the catalog name length
  817. is within bounds, and the packed pathname (if specified) is valid.
  818. }
  819. FUNCTION OCEValidPackedRLI({CONST}VAR prli: PackedRLI): BOOLEAN;
  820.     {$IFC NOT GENERATINGCFM}
  821.     INLINE $303C, 822, $AA5C;
  822.     {$ENDC}
  823. {
  824. If this packed RLI describes a Personal Catalog, this call will return a pointer
  825. to an alias record that can be used to find the actual file.  Otherwise, it returns nil.
  826. }
  827. FUNCTION OCEExtractAlias({CONST}VAR prli: PackedRLI): AliasPtr;
  828.     {$IFC NOT GENERATINGCFM}
  829.     INLINE $303C, 792, $AA5C;
  830.     {$ENDC}
  831. {
  832. This call returns a pointer to a packed RLI that represents the "Catalogs" icon, or
  833. the root of all catalogs.  It is used in the CollabPack.
  834. }
  835. FUNCTION OCEGetDirectoryRootPackedRLI: PackedRLI;
  836.     {$IFC NOT GENERATINGCFM}
  837.     INLINE $303C, 838, $AA5C;
  838.     {$ENDC}
  839. {*** LocalRecordID ***}
  840.  
  841. TYPE
  842.     LocalRecordID = RECORD
  843.         cid:                    CreationID;
  844.         recordName:                RStringPtr;
  845.         recordType:                RStringPtr;
  846.     END;
  847.  
  848.     LocalRecordIDPtr = ^LocalRecordID;
  849.  
  850. { Create a LocalRecordID from a name, type, and CreationID }
  851.  
  852. PROCEDURE OCENewLocalRecordID({CONST}VAR recordName: RString; {CONST}VAR recordType: RString; {CONST}VAR cid: CreationID; VAR lRID: LocalRecordID);
  853.     {$IFC NOT GENERATINGCFM}
  854.     INLINE $303C, 798, $AA5C;
  855.     {$ENDC}
  856. {
  857. Copy LocalRecordID lRID1 to LocalRecordID lRID2.  lRID2 must already contain
  858. pointers to RString structures large enough to hold copies of the corresponding
  859. fields from lRID1.  A memFull error will be returned if that is not the case.
  860. So if you allocate a brand new empty destination, you must at least set up
  861. its length field.
  862. }
  863. FUNCTION OCECopyLocalRecordID({CONST}VAR lRID1: LocalRecordID; VAR lRID2: LocalRecordID): OSErr;
  864.     {$IFC NOT GENERATINGCFM}
  865.     INLINE $303C, 770, $AA5C;
  866.     {$ENDC}
  867. {
  868. Check the equality of two local RIDs.
  869. }
  870. FUNCTION OCEEqualLocalRecordID({CONST}VAR lRID1: LocalRecordID; {CONST}VAR lRID2: LocalRecordID): BOOLEAN;
  871.     {$IFC NOT GENERATINGCFM}
  872.     INLINE $303C, 783, $AA5C;
  873.     {$ENDC}
  874. {*** ShortRecordID ***}
  875.  
  876. TYPE
  877.     ShortRecordID = RECORD
  878.         rli:                    PackedRLIPtr;
  879.         cid:                    CreationID;
  880.     END;
  881.  
  882.     ShortRecordIDPtr = ^ShortRecordID;
  883.  
  884. { Create a ShortRecordID from an RLI struct and a CreationID }
  885.  
  886. PROCEDURE OCENewShortRecordID({CONST}VAR theRLI: PackedRLI; {CONST}VAR cid: CreationID; sRID: ShortRecordIDPtr);
  887.     {$IFC NOT GENERATINGCFM}
  888.     INLINE $303C, 801, $AA5C;
  889.     {$ENDC}
  890. {
  891. Copy ShortRecordID sRID1 to ShortRecordID sRID2.  sRID2 must already contain
  892. pointers to structures large enough to hold copies of the corresponding
  893. fields from sRID1.  A memFull error will be returned if that is not the case.
  894. So if you allocate a brand new empty destination, you must at least set up
  895. its length fields.
  896. }
  897. FUNCTION OCECopyShortRecordID({CONST}VAR sRID1: ShortRecordID; VAR sRID2: ShortRecordID): OSErr;
  898.     {$IFC NOT GENERATINGCFM}
  899.     INLINE $303C, 778, $AA5C;
  900.     {$ENDC}
  901. {
  902. Check the equality of two short RIDs.
  903. }
  904. FUNCTION OCEEqualShortRecordID({CONST}VAR sRID1: ShortRecordID; {CONST}VAR sRID2: ShortRecordID): BOOLEAN;
  905.     {$IFC NOT GENERATINGCFM}
  906.     INLINE $303C, 791, $AA5C;
  907.     {$ENDC}
  908. {*** RecordID ***}
  909.  
  910. TYPE
  911.     RecordID = RECORD
  912.         rli:                    PackedRLIPtr;                            { pointer to a packed rli structure }
  913.         local:                    LocalRecordID;
  914.     END;
  915.  
  916.     RecordIDPtr = ^RecordID;
  917.  
  918. {    Create a RecordID from a packed RLI struct and a LocalRecordID.
  919. This doesn't allocate any new space; the RecordID points to the same
  920. packed RLI struct and the same name and type RStrings. }
  921.  
  922. PROCEDURE OCENewRecordID({CONST}VAR theRLI: PackedRLI; {CONST}VAR lRID: LocalRecordID; VAR rid: RecordID);
  923.     {$IFC NOT GENERATINGCFM}
  924.     INLINE $303C, 800, $AA5C;
  925.     {$ENDC}
  926. {
  927. Copy RecordID RID1 to RecordID RID2.  RID2 must already contain
  928. pointers to structures large enough to hold copies of the corresponding
  929. fields from lRID1.  A memFull error will be returned if that is not the case.
  930. So if you allocate a brand new empty destination, you must at least set up
  931. its length fields.
  932. }
  933. FUNCTION OCECopyRecordID({CONST}VAR rid1: RecordID; {CONST}VAR rid2: RecordID): OSErr;
  934.     {$IFC NOT GENERATINGCFM}
  935.     INLINE $303C, 777, $AA5C;
  936.     {$ENDC}
  937. {    Check the equality of two RIDs. }
  938. FUNCTION OCEEqualRecordID({CONST}VAR rid1: RecordID; {CONST}VAR rid2: RecordID): BOOLEAN;
  939.     {$IFC NOT GENERATINGCFM}
  940.     INLINE $303C, 788, $AA5C;
  941.     {$ENDC}
  942. {*** PackedRecordID ***}
  943. {
  944. struct PackedRecordID is a maximum-sized structure.  Allocate one of
  945. these and it will hold any valid packed RecordID.
  946. }
  947.  
  948. CONST
  949.     kPackedRecordIDMaxBytes        = 0+(kPathNameMaxBytes + sizeof(DNodeNum) + sizeof(DirDiscriminator) + sizeof(CreationID) + (3 * sizeof(RString)));
  950.  
  951.  
  952. TYPE
  953.     PackedRecordID = RECORD
  954.         dataLength:                INTEGER;
  955.         data:                    ARRAY [0..kPackedRecordIDMaxBytes-1] OF SInt8; (* Byte *)
  956.     END;
  957.  
  958. {
  959. struct ProtoPackedRecordID is a minimum-sized structure.  Use this
  960. for a variable-length packed RecordID.
  961. }
  962.     ProtoPackedRecordID = RECORD
  963.         dataLength:                INTEGER;
  964.     END;
  965.  
  966.     PackedRecordIDPtr = ^PackedRecordID;
  967.  
  968.     ProtoPackedRecordIDPtr = ^ProtoPackedRecordID;
  969.  
  970. {
  971. Copy PackedRecordID pRID1 to PackedRecordID pRID2.  pRID2 must already contain
  972. pointers to structures large enough to hold copies of the corresponding
  973. fields from pRID1.  A memFull error will be returned if that is not the case.
  974. pRID2Length is the number of bytes that can be put into pRID2, not counting the
  975. packed RecordID header.
  976. }
  977.  
  978. FUNCTION OCECopyPackedRecordID({CONST}VAR pRID1: PackedRecordID; {CONST}VAR pRID2: PackedRecordID; pRID2Length: INTEGER): OSErr;
  979.     {$IFC NOT GENERATINGCFM}
  980.     INLINE $303C, 774, $AA5C;
  981.     {$ENDC}
  982. {
  983. Create a RecordID from a PackedRecordID.
  984. NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE
  985. OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL
  986. }
  987. PROCEDURE OCEUnpackRecordID({CONST}VAR pRID: PackedRecordID; VAR rid: RecordID);
  988.     {$IFC NOT GENERATINGCFM}
  989.     INLINE $303C, 818, $AA5C;
  990.     {$ENDC}
  991. {
  992. Create a PackedRecordID from a RecordID.  pRID must be large enough to contain
  993. the packed RecordID.  A memFull error will be returned if that is not the case.
  994. packedRecordIDLength is the number of bytes that can be put into pRID, not
  995. counting the header.
  996. }
  997. FUNCTION OCEPackRecordID({CONST}VAR rid: RecordID; VAR pRID: PackedRecordID; packedRecordIDLength: INTEGER): OSErr;
  998.     {$IFC NOT GENERATINGCFM}
  999.     INLINE $303C, 806, $AA5C;
  1000.     {$ENDC}
  1001. {
  1002. Compute the number of bytes of memory needed to hold a RecordID when packed. This
  1003. length includes the length of the length field of PackedRecordID, so it
  1004. is safe to do a NewPtr (OCEPackedRecordIDSize(...)).
  1005. }
  1006. FUNCTION OCEPackedRecordIDSize({CONST}VAR rid: RecordID): INTEGER;
  1007.     {$IFC NOT GENERATINGCFM}
  1008.     INLINE $303C, 811, $AA5C;
  1009.     {$ENDC}
  1010. {
  1011. Check the equality of two packed RIDs.
  1012. }
  1013. FUNCTION OCEEqualPackedRecordID({CONST}VAR pRID1: PackedRecordID; {CONST}VAR pRID2: PackedRecordID): BOOLEAN;
  1014.     {$IFC NOT GENERATINGCFM}
  1015.     INLINE $303C, 786, $AA5C;
  1016.     {$ENDC}
  1017. { OCEValidPackedRecordID checks the validity of a packed record ID. }
  1018. FUNCTION OCEValidPackedRecordID({CONST}VAR pRID: PackedRecordID): BOOLEAN;
  1019.     {$IFC NOT GENERATINGCFM}
  1020.     INLINE $303C, 821, $AA5C;
  1021.     {$ENDC}
  1022. {*** DSSpec ***}
  1023.  
  1024. TYPE
  1025.     DSSpec = RECORD
  1026.         entitySpecifier:        ^RecordID;
  1027.         extensionType:            OSType;
  1028.         extensionSize:            INTEGER;
  1029.         extensionValue:            Ptr;
  1030.     END;
  1031.  
  1032.     DSSpecPtr = ^DSSpec;
  1033.  
  1034. {
  1035. struct PackedDSSpec is NOT a maximum-sized structure.  Allocate one of
  1036. these and it will hold any valid packed RecordID, but not necessarily any additional
  1037. data.
  1038. }
  1039.  
  1040. CONST
  1041.     kPackedDSSpecMaxBytes        = 0+(sizeof(PackedRecordID) + sizeof(OSType) + sizeof(UInt16));
  1042.  
  1043.  
  1044. TYPE
  1045.     PackedDSSpec = RECORD
  1046.         dataLength:                INTEGER;
  1047.         data:                    ARRAY [0..kPackedDSSpecMaxBytes-1] OF SInt8; (* Byte *)
  1048.     END;
  1049.  
  1050. {
  1051. struct ProtoPackedDSSpec is a minimum-sized structure.  Use this
  1052. for a variable-length packed DSSpec.
  1053. }
  1054.     ProtoPackedDSSpec = RECORD
  1055.         dataLength:                INTEGER;
  1056.     END;
  1057.  
  1058.     PackedDSSpecPtr = ^PackedDSSpec;
  1059.  
  1060.     ProtoPackedDSSpecPtr = ^ProtoPackedDSSpec;
  1061.  
  1062. {
  1063. Copy PackedDSSpec pdss1 to PackedDSSpec pdss2.  pdss2 must already contain
  1064. pointers to structures large enough to hold copies of the corresponding
  1065. fields from pdss1.  A memFull error will be returned if that is not the case.
  1066. pdss2Length is the number of bytes that can be put into pdss2, not counting the
  1067. packed DSSpec header.
  1068. }
  1069.  
  1070. FUNCTION OCECopyPackedDSSpec({CONST}VAR pdss1: PackedDSSpec; {CONST}VAR pdss2: PackedDSSpec; pdss2Length: INTEGER): OSErr;
  1071.     {$IFC NOT GENERATINGCFM}
  1072.     INLINE $303C, 771, $AA5C;
  1073.     {$ENDC}
  1074. {
  1075. Create a DSSpec from a PackedDSSpec.
  1076. NOTE THAT THE UNPACKED STRUCT CONTAINS POINTERS INTO THE PACKED STRUCT - DON'T DELETE
  1077. OR REUSE THE PACKED STRUCT UNTIL YOU ARE FINISHED WITH THE UNPACKED STRUCT AS WELL.
  1078. A pointer to the extension is returned in dss->extensionValue, and the length of that
  1079. extension is returned in dss->extensionSize.  If there is no extension, dss->extensionValue will
  1080. be set to nil.  This routine will unpack the RecordID (if any) into rid, unpack the rest
  1081. into dss, and set dss->entitySpecifier to rid.
  1082. }
  1083. PROCEDURE OCEUnpackDSSpec({CONST}VAR pdss: PackedDSSpec; VAR dss: DSSpec; VAR rid: RecordID);
  1084.     {$IFC NOT GENERATINGCFM}
  1085.     INLINE $303C, 815, $AA5C;
  1086.     {$ENDC}
  1087. {
  1088. Create a PackedDSSpec from a DSSpec.  pdss must be large enough to
  1089. contain the packed RecordID and any extension.  A memFull error will be returned if that
  1090. is not the case.  pdssLength is the number of bytes that can be put into pdss,
  1091. not counting the header.
  1092. }
  1093. FUNCTION OCEPackDSSpec({CONST}VAR dss: DSSpec; VAR pdss: PackedDSSpec; pdssLength: INTEGER): OSErr;
  1094.     {$IFC NOT GENERATINGCFM}
  1095.     INLINE $303C, 802, $AA5C;
  1096.     {$ENDC}
  1097. {
  1098. Compute the number of bytes of memory needed to hold a DSSpec when packed. This
  1099. length includes the length of the length field of PackedDSSpec, so it
  1100. is safe to do a NewPtr (OCEPackedDSSpecSize(...)).
  1101. }
  1102. FUNCTION OCEPackedDSSpecSize({CONST}VAR dss: DSSpec): INTEGER;
  1103.     {$IFC NOT GENERATINGCFM}
  1104.     INLINE $303C, 807, $AA5C;
  1105.     {$ENDC}
  1106. {    Check the equality of two DSSpecs.  This compares all fields, even the
  1107. extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and
  1108. diacrit-insensitive manner. }
  1109. FUNCTION OCEEqualDSSpec({CONST}VAR pdss1: DSSpec; {CONST}VAR pdss2: DSSpec): BOOLEAN;
  1110.     {$IFC NOT GENERATINGCFM}
  1111.     INLINE $303C, 782, $AA5C;
  1112.     {$ENDC}
  1113. {    Check the equality of two PackedDSSpecs.  This compares all fields, even the
  1114. extension (unless extensionSize == 0).  The extensions are compared in a case-insensitive and
  1115. diacrit-insensitive manner. }
  1116. FUNCTION OCEEqualPackedDSSpec({CONST}VAR pdss1: PackedDSSpec; {CONST}VAR pdss2: PackedDSSpec): BOOLEAN;
  1117.     {$IFC NOT GENERATINGCFM}
  1118.     INLINE $303C, 784, $AA5C;
  1119.     {$ENDC}
  1120. {
  1121. Check the validity of a PackedDSSpec.  If extensionType is
  1122. 'entn', pdss must contain a valid entitySpecifier.  For all other extensionTypes, a nil
  1123. entitySpecifier is valid, but if non-nil, it will be checked for validity.  No check
  1124. is made on the extension.
  1125. }
  1126. FUNCTION OCEValidPackedDSSpec({CONST}VAR pdss: PackedDSSpec): BOOLEAN;
  1127.     {$IFC NOT GENERATINGCFM}
  1128.     INLINE $303C, 819, $AA5C;
  1129.     {$ENDC}
  1130. {
  1131. Return info about a DSSpec.  This routine does not check validity.  If the
  1132. DSSpec has no extension, we determine whether it represents the root of all
  1133. catalogs, a single catalog, a DNode, or a Record.  Else it is invalid.
  1134. If the DSSpec has an extension, we simply return the extension type.
  1135. }
  1136. FUNCTION OCEGetDSSpecInfo({CONST}VAR spec: DSSpec): OSType;
  1137.     {$IFC NOT GENERATINGCFM}
  1138.     INLINE $303C, 793, $AA5C;
  1139.     {$ENDC}
  1140. { OCEGetExtensionType returns the extensionType imbedded in the PackedDSSpec. }
  1141. FUNCTION OCEGetExtensionType({CONST}VAR pdss: PackedDSSpec): OSType;
  1142.     {$IFC NOT GENERATINGCFM}
  1143.     INLINE $303C, 796, $AA5C;
  1144.     {$ENDC}
  1145. {
  1146. OCEStreamPackedDSSpec streams (flattens) a catalog object a little at a time by
  1147. calling the DSSpecStreamer routine that you provide.
  1148. }
  1149. TYPE
  1150.     DSSpecStreamerProcPtr = ProcPtr;  { FUNCTION DSSpecStreamer(buffer: UNIV Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT): OSErr; }
  1151.     DSSpecStreamerUPP = UniversalProcPtr;
  1152.  
  1153. CONST
  1154.     uppDSSpecStreamerProcInfo = $000037E0; { FUNCTION (4 byte param, 4 byte param, 1 byte param, 4 byte param): 2 byte result; }
  1155.  
  1156. FUNCTION NewDSSpecStreamerProc(userRoutine: DSSpecStreamerProcPtr): DSSpecStreamerUPP;
  1157.     {$IFC NOT GENERATINGCFM }
  1158.     INLINE $2E9F;
  1159.     {$ENDC}
  1160.  
  1161. FUNCTION CallDSSpecStreamerProc(buffer: UNIV Ptr; count: LONGINT; eof: BOOLEAN; userData: LONGINT; userRoutine: DSSpecStreamerUPP): OSErr;
  1162.     {$IFC NOT GENERATINGCFM}
  1163.     INLINE $205F, $4E90;
  1164.     {$ENDC}
  1165.     
  1166. TYPE
  1167.     DSSpecStreamer = DSSpecStreamerUPP;
  1168.  
  1169.  
  1170. FUNCTION OCEStreamPackedDSSpec({CONST}VAR dss: DSSpec; stream: DSSpecStreamer; userData: LONGINT; VAR actualCount: LONGINT): OSErr;
  1171.     {$IFC NOT GENERATINGCFM}
  1172.     INLINE $303C, 829, $AA5C;
  1173.     {$ENDC}
  1174. {*** AttributeType ***}
  1175. {
  1176. For the record, an AttributeType is an RString with a smaller maximum size.
  1177. I don't just typedef it to an RString, because I want the definition of the AttributeType
  1178. struct to contain the max length, because I need to include it in the Attribute struct
  1179. below.  But it should be possible to typecast any AttributeType to an RString and use
  1180. all the RString utilities on it.
  1181. }
  1182.  
  1183. TYPE
  1184.     AttributeType = RECORD
  1185.         charSet:                CharacterSet;
  1186.         dataLength:                INTEGER;
  1187.         body:                    ARRAY [0..kAttributeTypeMaxBytes-1] OF SInt8; (* Byte *) { always fixed at the max size }
  1188.     END;
  1189.  
  1190.     AttributeTypePtr = ^AttributeType;
  1191.  
  1192. { Miscellaneous defines:  (these cannot be made into enums) }
  1193.  
  1194. CONST
  1195.     kMinPackedRStringLength        = 0+(sizeof(ProtoRString));
  1196.  
  1197.     kMinPackedRLISize            = 0+(sizeof(ProtoPackedRLI) + sizeof(DirDiscriminator) + sizeof(DNodeNum) + kMinPackedRStringLength + sizeof(ProtoPackedPathName));
  1198.  
  1199.     
  1200. TYPE
  1201.     AttributeTag = DescType;
  1202.  
  1203.     AttributeValue = RECORD
  1204.         tag:                    AttributeTag;
  1205.         dataLength:                LONGINT;
  1206.         bytes:                    Ptr;
  1207.     END;
  1208.  
  1209.     AttributeValuePtr = ^AttributeValue;
  1210.  
  1211. {*** Attribute ***}
  1212.     Attribute = RECORD
  1213.         attributeType:            AttributeType;
  1214.         cid:                    AttributeCreationID;
  1215.         value:                    AttributeValue;
  1216.     END;
  1217.  
  1218.     AttributePtr = ^Attribute;
  1219.  
  1220.  
  1221. FUNCTION OCEGetIndRecordType(stringIndex: OCERecordTypeIndex): RString;
  1222.     {$IFC NOT GENERATINGCFM}
  1223.     INLINE $303C, 795, $AA5C;
  1224.     {$ENDC}
  1225. FUNCTION OCEGetIndAttributeType(stringIndex: OCEAttributeTypeIndex): AttributeType;
  1226.     {$IFC NOT GENERATINGCFM}
  1227.     INLINE $303C, 794, $AA5C;
  1228.     {$ENDC}
  1229.  
  1230. CONST
  1231.     _oceTBDispatch                = $AA5E;
  1232.  
  1233.  
  1234. {$ALIGN RESET}
  1235. {$POP}
  1236.  
  1237. {$SETC UsingIncludes := OCEIncludes}
  1238.  
  1239. {$ENDC} {__OCE__}
  1240.  
  1241. {$IFC NOT UsingIncludes}
  1242.  END.
  1243. {$ENDC}
  1244.